package com.Lyy.Config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@ComponentScan("com.Lyy.Controller")
@EnableWebMvc
public class SpringMvcConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/test.html").addResourceLocations("/test.html");
        // 前面 是指 http://localhost/test.html  ，css，js,html
        // 后面写。 这个路径 对应的物理文件的路径  /test.html
        registry.addResourceHandler("/**").addResourceLocations("/");  // 将所有controller里没写的路径，统统转发到webapp去找

    }
}
